<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Changing settings by template</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="index.html" title="Smarty 3 Manual">
<link rel="up" href="advanced.features.html" title="Chapter 17. Advanced Features">
<link rel="prev" href="advanced.features.html" title="Chapter 17. Advanced Features">
<link rel="next" href="advanced.features.template.inheritance.html" title="Template Inheritance">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<div class="navheader">
<table width="100%" summary="Navigation header">
<tr><th colspan="3" align="center">Changing settings by template</th></tr>
<tr>
<td width="20%" align="left">
<a accesskey="p" href="advanced.features.html">Prev</a> </td>
<th width="60%" align="center">Chapter 17. Advanced Features</th>
<td width="20%" align="right"> <a accesskey="n" href="advanced.features.template.inheritance.html">Next</a>
</td>
</tr>
</table>
<hr>
</div>
<div class="sect1" title="Changing settings by template">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="advanced.features.template.settings"></a>Changing settings by template</h2></div></div></div>
<p>
  Normally you configure the Smarty settings by modifying the <a class="link" href="api.variables.html" title="Chapter 13. Smarty Class Variables"><code class="varname">Smarty class variables</code></a>. Furthermore
  you can register plugins, filters etc. with <a class="link" href="api.functions.html" title="Chapter 14. Smarty Class Methods"><code class="varname">Smarty functions</code></a>. Modifications done to the Smarty object
  will be global for all templates.
 </p>
<p>
 However the Smarty class variables and functions can be accessed or called by induvidual template objects. Modification done to a template object
 will apply only for that template and its included subtemplates.
</p>
<p>
  </p>
<div class="example">
<a name="id458796"></a><p class="title"><b>Example 17.4. changing Smarty settings by template</b></p>
<div class="example-contents"><pre class="programlisting">

&lt;?php
$tpl = $smarty-&gt;createTemplate('index.tpl);
$tpl-&gt;cache_lifetime = 600;
//or
$tpl-&gt;setCacheLifetime(600);
$smarty-&gt;display($tpl);
?&gt;

    </pre></div>
</div>
<p><br class="example-break">
 </p>
<p>
  </p>
<div class="example">
<a name="id458816"></a><p class="title"><b>Example 17.5. register plugins by template</b></p>
<div class="example-contents"><pre class="programlisting">

&lt;?php
$tpl = $smarty-&gt;createTemplate('index.tpl);
$tpl-&gt;registerPlugin('modifier','mymodifier');
$smarty-&gt;display($tpl);
?&gt;

    </pre></div>
</div>
<p><br class="example-break">
 </p>
</div>
<div class="navfooter">
<hr>
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left">
<a accesskey="p" href="advanced.features.html">Prev</a> </td>
<td width="20%" align="center"><a accesskey="u" href="advanced.features.html">Up</a></td>
<td width="40%" align="right"> <a accesskey="n" href="advanced.features.template.inheritance.html">Next</a>
</td>
</tr>
<tr>
<td width="40%" align="left" valign="top">Chapter 17. Advanced Features </td>
<td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td>
<td width="40%" align="right" valign="top"> Template Inheritance</td>
</tr>
</table>
</div>
</body>
</html>
